<%@ page language="java" import="java.util.*" pageEncoding="utf-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<title>hello</title>
	<script type="text/javascript" src="/_ah/channel/jsapi"></script>
</head>
<body>
	<h1>Hello world</h1>
	<%
		String token = (String)session.getAttribute("token");
	%>
	<script type="text/javascript">
    	channel = new goog.appengine.Channel('<%=token%>');
    	socket = channel.open();
    	socket.onopen = function() {alert('channel is opened');}
    	socket.onmessage = function(msg){alert(msg.msg);}
    	socket.onerror = function(err){alert(err);}
    	socket.onclose = function() {alert('error');}
    </script>
    <textarea name="receiveContent" rows="10" cols="50"></textarea>
    
    <input name="send" value="发送">
</body>
</html>